<?php

namespace app\common\service\order\order_status\items;

use app\model\CouponOrder;

/**
 * 已取消
 */
class OrderStatusCancel extends OrderStatusBase
{

    public static function handle(CouponOrder $couponOrder, $next)
    {


        if (CouponOrder::C_PAY_STATUS_NO == $couponOrder->pay_status && in_array($couponOrder->status, [CouponOrder::C_STATUS_TIMEOUT_CLOSE])) {

            //权益特殊处理
            if ($couponOrder->serv_type == PRODUCT_COUPON_SERV && $couponOrder->type == CouponOrder::TYPE_COUPON_SELF_EMPLOYED){
                return $couponOrder->params['return_status'] = self::getReturnStatus(self::CANCLE, '已关闭');
            }
            return $couponOrder->params['return_status'] = self::getReturnStatus(self::CANCLE, '无效订单');

        }


        return $next($couponOrder);
    }
}